package com.example.donghuihui.androidframe.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * 启动页自定义ViewPager，滑动到最后一页再向左滑动关闭欢迎页
 */
public class CustomViewPager extends ViewPager {
    private EventChangeListener mEventChangeListener;

    public CustomViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        mEventChangeListener.eventChange(ev);
        return super.onTouchEvent(ev);
    }

    public void setOnEventChangeListener(EventChangeListener eventChangeListener){
        mEventChangeListener = eventChangeListener;
    }

    public interface EventChangeListener{
        public void eventChange(MotionEvent event);
    }

}
